/**
 * Created by IntelliJ IDEA.
 * User: ryan
 * Date: Jul 5, 2010
 * Time: 9:49:11 PM
 * To change this template use File | Settings | File Templates.
 */ 
$(function() {
	module('audiostream');

	test("Div Present", 1, function() {
		var div = $('#panel');
		ok(div,'Div present');
	});
	
	test("Create Outer Div", 2, function() {
		var div = $('#panel');
		var text = 'The topic title';
		
		var pps = .2;
		
		wikid.ui.createTimeBand(div, pps, div.width());
		
		
		wikid.ui.createOuterTagDiv(div, '123', text, 20, 100, pps);
		wikid.ui.createInnerTagDiv('123',  '456', 'some long stuff!', 30,pps);
		
		wikid.ui.createInnerTagDiv('123',  '457', 'This is good, I think, I want one, two or three', 90,pps);
		
		wikid.ui.createInnerTopic('123', '458',  'Textosaurus', 40, 20, pps);
		wikid.ui.createInnerTagDiv('458',  '459', 'He is the hunter of long winded words', 45,pps);
		
		wikid.ui.createInnerTagDiv('123',  '460', 'Short Segment', 80,pps);
		
		equals(div.find('.tagholder').css('margin-left'), '20px', 'margin-left is correct');
		equals(div.find('.streambar').width(), '100', 'width is correct');
		//equals(div.find('.tagtopic').text(), text, 'Label is correct');
	});
	
	test("Calculate Pixel Size", 3, function() {
		var result = wikid.ui.calculateSecondsPixelSize(10, 1);
		equals(result, "10", "10 pixels/seconds");
		
		var result = wikid.ui.calculateSecondsPixelSize(11, .5);
		equals(result, "6", "Round pixel size");
		
		var result = wikid.ui.calculateSecondsPixelSize(1, .222);
		equals(result, "1", "Never go below zero");
		
		
		
	});
	
	
	test("Calculate Pixels/Second", 3, function() {
		var result = wikid.ui.calculatePixelsPerSecond(100,100)
		equals(result, "1", "Zoom size defaults to 1.");

        result = wikid.ui.calculatePixelsPerSecond(200, 100, 2);
        equals(result, "1", "Double zoom p/s. ");

        result = wikid.ui.calculatePixelsPerSecond(200, 400);
        equals(result, ".5", "Half zoom should half pixel size. ");

	});
});